The RESTEasy component in SwitchYard provides REST-based binding support for services and references in SwitchYard.
Binding Services with RESTEasy
Composite-level services can be exposed as a REST-based service using the <binding.rest> binding definition. The following configuration options are available for binding.rest when binding services:
Here's an example of what a REST service binding looks like:
<sca:service name="OrderService" promote="OrderService/OrderService">
<rest:binding.rest>
<rest:interfaces>org.switchyard.quickstarts.rest.binding.OrderResource,org.switchyard.quickstarts.rest.binding.TestResource</rest:interfaces>
<rest:contextPath>rest-binding</rest:contextPath>
</rest:binding.rest>
</sca:service>
Binding References with RESTEasy
Binding a reference with REST can be used to make REST-based services available to SwitchYard services. The following configuration options are available for binding.rest when binding references:
-
interfaces : A comma seperated list of interfaces or abstract/empty classes with JAX-RS annotations.
-
address : A URL that points to the root path of resources. This is only applicable for Reference bindings. It is optional and if not specified will default to http://127.0.0.1:8080/.
-
contextPath : Additional context path for the REST endpoint. Default is none.
Here's an example of what a REST reference binding looks like:
<sca:reference name="Warehouse" promote="OrderService/Warehouse" multiplicity="1..1">
<rest:binding.rest>
<rest:interfaces>org.switchyard.quickstarts.rest.binding.WarehouseResource</rest:interfaces>
<rest:address>http://localhost:8080</rest:address>
<rest:contextPath>rest-binding</rest:contextPath>
</rest:binding.rest>
</sca:reference>
In this example above the resource URLs will start from http://localhost:8080/rest-binding.